// (function () {
//   let ul = document.querySelector(".nav-bar");
//   let lis = ul.children
//   for(let i of lis){
//       i.addEventListener("mouseover",function(){
//           console.log(this.children[0]);
//           for(let j of lis){
//             j.children[0].style.color = "#000"
//             j.children[0].style.borderColor = "#fff"
//           }
//           this.children[0].style.color = "#1ab6c0"
//           this.children[0].style.borderColor = "#1ab6c0"

//       })
//   }

// })();
(function(){
  let header = document.querySelector(".header");
  let navbar = document.querySelector(".nav-bar-main");
  let cartgory = document.querySelector(".right-top");
  let headerheight = header.offsetHeight;
  let navbarhight = navbar.offsetHeight;
  let righttop = document.querySelector(".right-top");
  let close = document.querySelector(".close");
  cartgory.addEventListener("touchstart", function () {
    navbar.style.top = headerheight + "px";
    righttop.style.display = "none";
    close.style.display = "block";
    stop()
  });
  close.addEventListener("touchstart", function () {
    navbar.style.top = -navbarhight + "px";
    righttop.style.display = "block";
    close.style.display = "none";
    move()
  });
  var mo=function(e){
    e.preventDefault()
 };
 
/***禁止滑动***/
function stop(){
    document.body.style.overflow='hidden';
    document.addEventListener("touchmove",mo,false);//禁止页面滑动
}
 
/***取消滑动限制***/
function move(){
    document.body.style.overflow='';//出现滚动条
    document.removeEventListener("touchmove",mo,false);
}
})()